<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1, maximum-scale=1, user-scalable=no">
    <title>武汉中百罗森一元抢</title>
    <meta name="description" content="点击立即参与武汉罗森一元抢活动，最低优惠送给你" />
    <link rel="stylesheet" href="css/main.css">
      <script src="https://cdn1.lncld.net/static/js/av-min-1.2.1.js"></script>

</head>

<body>
    <div>
        <img src="img/1.jpg" alt="">
    </div>
    <div>
        <a><img src="img/2.jpg" alt=""></a>
    </div>
    <div>
        <img src="img/3.jpg" alt="">
    </div>
</body>
<script type="text/javascript" src="http://apps.bdimg.com/libs/zepto/1.1.4/zepto.min.js"></script>

<script type="text/javascript">
window.alert = function(name) {
    var iframe = document.createElement("IFRAME");
    iframe.style.display = "none";
    iframe.setAttribute("src", 'data:text/plain,');
    document.documentElement.appendChild(iframe);
    window.frames[0].window.alert(name);
    iframe.parentNode.removeChild(iframe);
}
$(function() {
  var APP_ID = 'clQBJfHIrQilgtWglcNdJgBq-gzGzoHsz';
  var APP_KEY = 'KzXXOe5uHJYmqR7q2jxmQowP';
  AV.init({appId: APP_ID, appKey: APP_KEY});
    $('a').click(function() {
        //当前时间
        var current_time = new Date()
            //活动时间
        var activity_time = new Date("2017/7/7,10:00:00"); //结束时间

        var cql = 'select count(*) from Users';
        AV.Query.doCloudQuery(cql).then(function(data) {
           var count = data.count;
           if(count > 1000){
               location.href = "end.html"
           }else{
             if (current_time <= activity_time) {
                 alert('活动在7月7日上午10点准时开始。更多优惠，请下载罗森点点');
                 return false;
             } else {
                 location.href = "form.html"
             }
           }
        })

    })
})
</script>

</html>
